package cn.jiyun.service.fegin;

import cn.jiyun.entity.ResultClass;
import cn.jiyun.entity.day15.Train;
import cn.jiyun.entity.day15.TrainDTO;
import cn.jiyun.entity.day15.TrainVO;
import cn.jiyun.entity.day9.CourseVO;
import com.github.pagehelper.PageInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.data.annotation.ReadOnlyProperty;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("day15-train")
public interface TrainFeginService {
    /*
     * @description:
     * @author: sjt
     * @date: 2023/8/31 11:15
     * @param: [uid]
     * @return: java.util.List<java.lang.Integer>
     * @annotate:根据用户id/返回该用户的培训个数和课程个数
    **/
    @GetMapping("/train/findTrainAndCourseCount")
    public List<Integer> findTrainCount(@RequestParam("uid") Integer uid);
    /*
     * @description:
     * @author: sjt
     * @date: 2023/8/31 11:15
     * @param: []
     * @return: java.util.List<java.lang.String>
     * @annotate:查询学习人数最多的四个培训
    **/
    @GetMapping("/train/findFourCountMaxCourse")
    public List<String> findFourCountMaxCourse();

//
//    @GetMapping("/train/findXueCount")
//    Integer selectXueCount(@RequestParam("cid")Integer cid);


    /*
     * @description:
     * @author: sjt
     * @date: 2023/8/31 11:16
     * @param: [cid]
     * @return: java.lang.Integer
     * @annotate:根据课程id/返回此课程学习的人数(因为关联关系是:用户-竞赛-课程)
    **/
    @GetMapping("/train/findCourseXueCount")
    Integer findCourseXueCount(@RequestParam("cid") Integer cid);
//返回最新的四个培训
    @GetMapping("/train/findNewFourTrain")
    ResultClass findNewFourTrain();

    /*
     * @description:
     * @author: sjt
     * @date: 2023/8/31 18:41
     * @param: [dto]
     * @return: void
     * @annotate: 分页查询培训内容
    **/
    @PostMapping("/train/findTrainList")
    ResultClass findTrainList(@RequestBody TrainDTO dto);

    /*
     * @description:
     * @author: sjt
     * @date: 2023/8/31 19:53
     * @param: [uid, tid]
     * @return: cn.jiyun.entity.ResultClass boolean
     * @annotate:查询当前用户是否报名此培训
    **/
    @GetMapping("/train/findUserIfParticipate")
    ResultClass findUserIfParticipate(@RequestParam("uid") Integer uid,@RequestParam("tid") Integer tid);

    //用户参加培训
    @GetMapping("/train/participateTrain")
    boolean participateTrain(@RequestParam("uid") Integer uid,@RequestParam("tid") Integer tid);

    //查询培训关联的课程信息
    @GetMapping("/train/findTrainCourseIds")
    List<Integer> findTrainCourseIds(@RequestParam("tid") Integer tid);

    //查询培训相关的测试信息
    @GetMapping("/train/findTestPaperIds")
    List<Integer> findTestPaperIds(@RequestParam("tid") Integer tid);

    //查询当前登录人学习的课程id集合
    @GetMapping("/train/selectLoginUserCourseIds")
    List<Integer> selectLoginUserCourseIds(@RequestParam("uid")Integer uid);

    //查询登录人的培训列表
    @PostMapping("/train/selectLoginUserTrainList")
    PageInfo<TrainVO> selectLoginUserTrainList(@RequestParam("uid") Integer uid, @RequestBody TrainDTO trainDTO);
//
//    //根据试卷id返回试题个数
//    @GetMapping("/train/findTestPaperTopicNum")
//    Integer findTestPaperTopicNum(@RequestParam("pid") Integer pid);
}
